package com.example.demo.Thread;

import org.apache.commons.lang3.StringEscapeUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Description
 * @Author
 * @Date 2020/2/27 14:57
 **/
public class Test {
    public static void main(String[] args) {
        int i = Integer.valueOf("98", 2);
        plusOne(new int[]{1});
    }

    public static int[] plusOne(int[] digits) {
        for (int i = digits.length - 1; i >= 0; i--) {
            digits[i]++;
            digits[i] = digits[i] % 10;
            if (digits[i] != 0) return digits;
        }
        digits = new int[digits.length + 1];
        digits[0] = 1;
        return digits;
    }
}
